const template = require('art-template');

template.defaults.imports.classNameFilter = function(value){
    if(value===0){
        return 'first'
    }else if(value===1){
        return 'second'
    }else if(value===2){
        return 'third'
    }else{
        return ''
    }
}
template.defaults.imports.dateFormat = function(value){
    var d = new Date(value);
    var time = d.getFullYear()+'-'+(d.getMonth()+1)+'-'+d.getDate()+'  '+d.getHours()+':'+d.getMinutes()+':'+d.getSeconds();
    return time
}
function time(date){
    var y = date.getFullYear();  
                var m = date.getMonth() + 1;  
                m = m < 10 ? ('0' + m) : m;  
                var d = date.getDate();  
                d = d < 10 ? ('0' + d) : d;  
                var h = date.getHours();  
                h=h < 10 ? ('0' + h) : h;  
                var minute = date.getMinutes();  
                minute = minute < 10 ? ('0' + minute) : minute;  
                var second=date.getSeconds();  
                second=second < 10 ? ('0' + second) : second;  
                return y + '-' + m + '-' + d+' '+h+':'+minute+':'+second;  
}
module.exports = {
    time
}